import request from '@/utils/request'
import { getToken } from '@/utils/auth'
var token = getToken();
export function getDeviceList (projectId, no, deviceStatus, type, page, pageSize, draw) {
  return request({
    url: '/pc/management/device/getlist',
    method: 'post',
    data: {
      token: token,
      deviceStatus: deviceStatus,
      no: no,
      type: type,
      page: page,
      draw: draw,
      pageSize: pageSize,
      projectId: projectId
    }
  })
}
export function getNum () {
  return request({
    url: '/pc/management/device/getNum',
    method: 'post',
    data: {
      token: token,
    }
  })
}
export function getDetail (id) {
  return request({
    url: '/pc/management/device/detailDevice',
    method: 'post',
    data: {
      token: token,
      id: id
    }
  })
}
export function editDevice (id, cameraIp, managementName, managementPhone, projectId) {
  return request({
    url: "/pc/management/device/editDevice",
    method: 'post',
    data: {
      token: token,
      id: id,
      projectId: projectId,
      cameraIp: cameraIp,
      managementName: managementName,
      managementPhone: managementPhone
    }
  })
}
  
export function getDetailList (id, page, pageSize) {
  return request({
    url: '/pc/management/device/listDevice',
    method: 'post',
    data: {
      token: token,
      id: id,
      draw: 1,
      page: page,
      pageSize: pageSize
    }
  })
}
export function addDevice (no, cameraIp, managementName, managementPhone, projectId) {
  return request({
    url: "/pc/management/device/addDevice",
    method: 'post',
    data: {
      token: token,
      no: no,
      projectId: projectId,
      cameraIp: cameraIp,
      managementName: managementName,
      managementPhone: managementPhone
    }
  })
}
export function getNo () {
  return request({
    url: "/pc/management/device/getNo",
    method: 'post',
    data: {
      token: token,
    }
  })
}
